package com.wd.good.service.impl;

import com.wd.good.service.CommonService;
import org.springframework.stereotype.Service;

/**
 * @description: 实现类
 * @author wangdpng
 * @date 2023/11/18 9:53
 */
@Service
public class CommonServiceImpl implements CommonService {
    @Override
    public void doSomething() {
        // 手动重试,和功能耦合
        /*int times = 1;
        while (times <= 5) {
            try{
                int i = 3/0;
                // do something
            }catch (RuntimeException e){
                System.out.println("重试次数"+ times +"次");
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException ex) {
                    throw new RuntimeException(ex);
                }
                times++;
                if (times > 5) {
                    throw new RuntimeException("重试次数超过5次");
                }
            }
        }*/
    }
}
